<div class="left" style="padding-left: 50px;">
    <?php echo $html->image('its.gif', array('width' => '288', 'height' => '256')); ?>
</div>
<div id="login" class="right">
    <?php echo $form->create('User', array('action' => 'login')); ?>
    <fieldset>
        <legend>Login</legend>
        <table>
            <tr>
                <td width="80px"><?php echo $form->label('username', 'Username', array('id' => 'LoginUsername')); ?></td>
                <td><?php echo $form->text('username'); ?></td>
            </tr>
            <tr>
                <td><?php echo $form->label('password', 'Password', array('id' => 'LoginPassword')); ?></td>
                <td><?php echo $form->password('password'); ?></td>
            </tr>
            <tr>
                <td align="center">&nbsp;</td>
                <td class="right">
                    <button id="loginButton" class="right ui-state-default ui-corner-all" type="button" onclick="this.form.submit()" style="padding: 2px; margin-top: 5px">Login</button>
                </td>
            </tr>
        </table>
    </fieldset>
    <?php echo $form->end(); ?>
    <div class="right">
        <?php
        if ($session->check('Message.flash')) {
            $session->flash();
        }
        if  ($session->check('Message.auth')) {
            $session->flash('auth');
        }
        ?>
    </div>
</div>
<script type="text/javascript">

    $j(function() {
        $j("#loginButton").handover();

        // ไม่ให้จำ password
        $("UserUsername").observe("keypress", function() {
            $("UserPassword").value = "";
        })

        // ถ้ากด enter ที่ username หรือ password ให้ log in ได้เลย
        $j("#UserUsername, #UserPassword").bind("keypress", function(event) {
            if (event.keyCode == 13) {// key enter
                $j(this).parents('form').submit();
            }
        })
        $("UserUsername").focus();
    });
</script>
